package com.bfs.anasit.service;

import com.bfs.anasit.model.AnasitRole;
import com.bfs.anasit.repository.AnasitRoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: lukman
 * Date: 6/24/11
 * Time: 1:13 PM
 * To change this template use File | Settings | File Templates.
 */
@Service("anasitRoleService")
@Named("anasitRoleService")
@SessionScoped
public class AnasitRoleServiceImpl implements AnasitRoleService {

    @SuppressWarnings("unused")
    @PersistenceContext
    private EntityManager em;

    @Autowired
    private AnasitRoleRepository anasitRoleRepository;

    @Override
    public AnasitRole findById(Long Id) {
        return anasitRoleRepository.findOne(Id);
    }

    @Override
    public List<AnasitRole> findAllAnasitRoles() {
        return anasitRoleRepository.findAll();
    }

    @Override
    public void update(AnasitRole anasitRole) {
        anasitRoleRepository.save(anasitRole);
    }

    @Override
    public void delete(AnasitRole anasitRole) {
        anasitRoleRepository.delete(anasitRole);
    }

    @Override
    public void save(AnasitRole anasitRole) {
        anasitRoleRepository.save(anasitRole);
    }
}
